﻿using Nop.Web.Framework.Localization;
using Nop.Web.Framework.Mvc.Routes;
using System.Web.Mvc;
using System.Web.Routing;

namespace Nop.Web.WindAlert
{
    public partial class RouteProvider : IRouteProvider
    {
        public void RegisterRoutes(RouteCollection routes)
        {

            //windalert
            // home page
            routes.MapLocalizedRoute("Home",
                            "",
                            new { controller = "Wind", action = "Index" },
                            new[] { "Nop.Web.Controllers" });

            //Cameras
            routes.MapLocalizedRoute("Cameras",
                            "מצלמות",
                            new { controller = "WCamera", action = "Index" },
                            new[] { "Nop.Web.Controllers" });

            //Forecast
            routes.MapLocalizedRoute("Forecast",
                            "forecast/{addDays}",
                            new { controller = "WForecast", action = "Index" },
                            new { addDays = @"\d+" },
                            new[] { "Nop.Web.Controllers" });
            routes.MapLocalizedRoute("WaveForecast",
                            "WaveForecast/{addDays}",
                            new { controller = "WForecast", action = "WaveForecast" },
                            new { addDays = @"\d+" },
                            new[] { "Nop.Web.Controllers" });
            //Metar
            routes.MapLocalizedRoute("Metar",
                            "metar",
                            new { controller = "WMetar", action = "index" },
                            new[] { "Nop.Web.Controllers" });
            //Store page
            routes.MapLocalizedRoute("Store",
                            "store",
                            new { controller = "Home", action = "Index" },
                            new[] { "Nop.Web.Controllers" });
            //chart
            routes.MapLocalizedRoute("WaveChart",
                            "WaveChart/{spotId}",
                            new { controller = "WSpot", action = "WaveChart" },
                            new { spotId = @"\d+"},
                            new[] { "Nop.Web.Controllers" });
            routes.MapLocalizedRoute("WindChart",
                            "WindChart/{spotId}",
                            new { controller = "WSpot", action = "WindChart" },
                            new { spotId = @"\d+"},
                            new[] { "Nop.Web.Controllers" });
            //comments
            routes.MapLocalizedRoute("SpotComments",
                           "Reports",
                           new { controller = "WSpot", action = "SpotComments" },
                           new[] { "Nop.Web.Controllers" });
            routes.MapLocalizedRoute("SpotCommentEdit",
                           "spot/commentedit/{id}",
                           new { controller = "WSpot", action = "CommentEdit" },
                           new { id = @"\d+" },
                           new[] { "Nop.Web.Controllers" });
            routes.MapLocalizedRoute("SpotCommentDelete",
                            "spot/commentdelete/{id}/{slug}",
                            new { controller = "WSpot", action = "CommentDelete", slug = UrlParameter.Optional },
                            new { id = @"\d+" },
                            new[] { "Nop.Web.Controllers" });

            //poll vote AJAX link
            routes.MapLocalizedRoute("SpotTable",
                            "Spot/SpotTable",
                            new { controller = "WSpot", action = "SpotTable" },
                            new[] { "Nop.Web.Controllers" });

        }

        public int Priority
        {
            get
            {
                return 1;
            }
        }
    }
}
